<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;

$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$basic=$this->plugin_setting('basic');
$return['banner']=$basic['image'];
$return['basic']=$basic;
//证明
if($_RQ['op']=='main'){
	$id=$_RQ['id'];
	if(!$_RQ['id']){
		$id=$this->session('id',$id);
		
	}
	if(!$id){
		exi('未找到项目信息！','error');
	}
	//查询是否已经证明过
	$this->session('id',$id);
	$iszm=pdo_get('jy_zhongchou_zhengming',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'pid'=>$id,'status <'=>2));
	if(!empty($iszm)){
		exi('您已证明过了','error','jy_zhongchou/p_detail//id='.$id);
	}
	$relationlist=array('1'=>'亲属','2'=>'朋友','3'=>'同事','4'=>'同学','5'=>'邻居','6'=>'病友','7'=>'医护','8'=>'其他');

	if($_RQ['postdata']){
		$postdata=get_postdata();
		if(!$postdata['rid']){
			exi('请选择关系','error');
		}
		if(empty($postdata['realname'])){
			exi('请填写您的姓名','error');
		}
		if(empty($postdata['idcard'])){
			exi('请填写您的身份证号','error');
		}
		if(empty($postdata['desc'])){
			exi('请填写您的证明内容','error');
		}
		$insert=array(
			'uniacid'=>$_SESSION['uniacid'],
			'mid'=>$_SESSION['uid'],
			'pid'=>$id,
			'relation'=>$postdata['rid'],
			'realname'=>$postdata['realname'],
			'desc'=>$postdata['desc'],
			'idcard'=>$postdata['idcard'],
			'createtime'=>TIMESTAMP
		);
		pdo_insert('jy_zhongchou_zhengming',$insert);
		exi('提交成功','','/p_detail//id='.$id);
	}
	$return['post']=array();
	$return['relationlist']=$relationlist;
	$return['id']=$id;
	exi($return);

}